import {service} from './fetch';

let api = {};
//获取登陆信息
api.login = function (data, success) {
  let config = {
    url: '/api/erp/v1/user/login',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//退出
api.logout = function (data, success) {
  let config = {
    url: '/api/erp/v1/user/logout',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获取新增公司的信息
api.addCompanyInfo = function (data, success) {
  let config = {
    url: '/api/erp/v1/company/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//公司信息新增(new)
api.enterpriseAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/enterprise/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//公司信息list(new)
api.enterpriseList = function (data, success) {
  let config = {
    url: '/api/erp/v1/enterprise/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//公司信息getOne(new)
api.enterpriseGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/enterprise/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//公司信息Update(new)
api.enterpriseUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/enterprise/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//公司信息delete(new)
api.enterpriseDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/enterprise/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获取新增公司的信息的页码
api.addCompanyList = function (data, success) {
  let config = {
    url: '/api/erp/v1/company/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//修改公司的信息的页码
api.addCompanyUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/company/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//编辑公司的信息
api.getCompanyInfo = function (data, success) {
  let config = {
    url: '/api/erp/v1/company/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//删除公司的信息
api.CompanyDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/company/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//添加仓库信息
api.depotAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//查询
api.depotList = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//编辑仓库信息
api.depotGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//删除仓库信息
api.depotDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//更新仓库编辑信息
api.depotUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌信息(new)add
api.newBrandAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌新增的合作公司 or 根据品牌方或者我们 查看接口（new）
api.companyListAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/list/brand',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌list(new)
api.newBrandList = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//品牌信息更新 update（new）
api.newBrandUpDateOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌信息查看get/one（new）
api.newBrandGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/get/one',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据品牌方或者我们 查看接口（new）
api.brandListAuthorizer = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/list/authorizer',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//被授权方（new）
api.enterpriseListCompany = function (data, success) {
  let config = {
    url: '/api/erp/v1/enterprise/list/company',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//被授权方（new）
api.restrictionArea = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/get/authorization/restriction/area',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//添加授权new
api.addAuthorization = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/add/authorization',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌信息列表字段初始化以及添加渲染
api.brandListAll = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/list/all',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌信息更新字段
api.brandListUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//品牌信息删除字段
api.brandDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商列表渲染以及初始化
api.supplyList = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商更新字段
api.supplyUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商添加字段
api.supplyAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商添加字段new
api.supplierAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商list接口(new)
api.supplierList = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商get/one接口(new)
api.supplierGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商update接口(new)
api.supplierUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商delete接口(new)
api.supplierDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商获取字段
api.supplyGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商删除字段
api.supplyDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//新增供应商信息合作公司的接口
api.getCompany = function (data, success) {
  let config = {
    url: '/api/erp/v1/web/get/company',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获得单位，尺寸商品信息
api.getValue = function (data, success) {
  let config = {
    url: '/api/erp/v1/dic/get/value',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获得分类，尺寸商品信息
api.getCategory = function (data, success) {
  let config = {
    url: '/api/erp/v1/web/get/category',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//商品信息的添加（new）
api.itemAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/item/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获取所有的品牌（new） 新增商品add
api.newBrandSelector = function (data, success) {
  let config = {
    url: '/api/erp/v1/new/brand/selector',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
// 新增商品add  单位接口（new）
api.itemUnitSelector = function (data, success) {
  let config = {
    url: '/api/erp/v1/item/unit/selector',
    method: 'get',
    params:data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//创建商品
api.productAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获取商品品牌的下拉框
api.brandList = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//上传图片接口
api.uploadImg = function (data, success) {
  let config = {
    url: '/api/erp/qny/pic/qiniu',
    method: 'post',
    data,
    headers: {
      'content-type': 'multipart/form-data'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//初始化商品列表
api.productList = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/list ',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//删除商品信息列表
api.productDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//商品信息修改确定按钮
api.productUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//商品信息查询
api.productGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.productItemList = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/list ',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据品牌查供应商and根据品牌和供应商查供应商下所有商品
api.productItemGetSupply = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/get/supply',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.productItemAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.productItemDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//平台信息的添加（new）
api.platformAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/platform/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//平台信息的查询公司接口（new）
api.getCompanyListByNature = function (data, success) {
  let config = {
    url: '/api/erp/v1/cooperation/company/list/platform',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//平台信息list（new）
api.platformList = function (data, success) {
  let config = {
    url: '/api/erp/v1/platform/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//平台信息delete（new）
api.platformDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/platform/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//平台信息get/one（new）
api.platformGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/platform/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//平台信息update（new）
api.platformUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/platform/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道信息创建接口
api.channelAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道信息list列表接口
api.channelList = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.channelGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.channelUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.channelDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.brandListAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//授权产品基本信息查询接口
api.productItemGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据公司查供应商采购
api.findSupplyByCompany = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/findSupplyByCompany',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//删除采购订单
api.deletePurOrder = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/delete?purId=' + data,
    method: 'POST',
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};
//创建采购订单
api.buyPurAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//采购计划列表
api.purchasePlanList = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/plan/page',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};

//新增采购计划
api.addPurchasePlan = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/plan/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};

//删除采购计划
api.delPurchasePlan = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/plan/delete?id=' + data,
    method: 'post',
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};

//采购计划商品明细
api.purchasePlanItems = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/plan/getItems?purPlanId=' + data,
    method: 'post',
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};

//编辑采购计划
api.updatePurchasePlan = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/plan/edit',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};
//通过条件筛选上月1号到目前未处理的采购计划
api.searchConditionPurPlanBList = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/plan/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
};


//采购订单初始化
api.buyPurList = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购发票列表的初始化(new)
api.buyInvoicePurList = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购发票删除
api.purInvoiceDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购发票通知
api.purInvoiceremitAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/remit/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购发票通知删除接口
api.purInvoiceremitDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/remit/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

/**
 * 采购打款、财务打款审批接口
 */
api.remitConfirm = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/remit/confirm',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}


//更新采购单
api.updatePurchaseOrder = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//采购申请接口
api.buyPurListItem = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/list/item',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购申请接口
api.buyPurListItemNew = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/list/item/new',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//供应商下拉框列表
api.getSupply = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/get/supply',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据品牌查供应商下拉列表
api.getBrandSupply = function (data, success) {
  let config = {
    url: '/api/erp/v1/supply/brand/supply',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//诉单管理创建(new)
api.chcomformaAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//诉单管理list(new)
api.chcomformaComplainList = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/complainList',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//诉单管理创建接口的查询(new)
api.chcomformaSelectInformation = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/selectInformation',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//诉单修改
api.chcomformaUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//诉单修改获取id
api.chcomformaGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

// //诉单删除
// api.chcomformaDelete = function(data, success) {
//         let config = {
//             url: '/api/erp/v1/chcomforma/delete',
//             method: 'get',
//             params: data,
//             headers: {
//                 'content-type': 'application/json'
//             }

//         };
//         return service(config)
//             .then((data) => {
//                 if (data.status === 200)
//                     success(data.data);
//                 else
//                     console.log(data)
//             })
//             .catch()
//     }

//诉单删除(new)
api.chcomformaDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//诉单物流信息查询
api.chcomformaSelectLogistics = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/selectLogistics',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}


//诉单导出excel
api.chcomformaExport = function (data, success) {
  let config = {
    url: ' /api/erp/v1/chcomforma/export',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//邮政扣款
api.listPostalDeductions = function (data, success) {
  let config = {
    url: '/api/erp/v1/chcomforma/list/postalDeductions',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购申请合同的生成
api.contractCreate = function (data, success) {
  let config = {
    url: '/api/erp/v1/contract/create',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道商品详情的创建弹框
api.getCreateChannelInfo = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道商品名称的添加
api.channelProductAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/product/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道商品名称的list列表
api.channelProductList = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/product/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道商品详情
api.channelProductInfoGetone = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/product/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.channelProductInfoUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/product/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//删除渠道商品详情
api.channelProductInfoDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/product/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}


//品牌信息里面创建的授权品牌select框
api.getBrandDetail = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/info',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.orderManagementAllQuery = function (data, success) {
  let config = {
    url: '/api/erp/v1/orderManagement/query',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}


//获取审批用户列表
api.getApproveUserList = function (data, success) {
  let config = {
    url: '/api/erp/v1/sys/getApprovalUser',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//新增用户接口(new)
api.sysAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/sys/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//用户初始化接口(使用new)
api.sysList = function (data, success) {
  let config = {
    url: '/api/erp/v1/sys/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//修改用户权限(new)
api.sysUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/sys/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据id 修改数据（用户）
api.sysSelectOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/sys/selectOne',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//获取角色(new )员工管理add
api.roleList = function (data, success) {
  let config = {
    url: '/api/erp/v1/role/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//删除用户信息(new)
api.sysDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/sys/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//角色的(tree树)
api.resourcesList = function (data, success) {
  let config = {
    url: '/api/erp/v1/resources/list',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//权限管理获取菜单栏
api.resourcesList = function (data, success) {
  let config = {
    url: '/api/erp/v1/resources/list',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//角色list列表(new)
api.roleNewList = function (data, success) {
  let config = {
    url: '/api/erp/v1/role/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//角色新增（new）
api.roleAddRole = function (data, success) {
  let config = {
    url: '/api/erp/v1/role/addRole',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//角色修改（new）
api.roleSelect = function (data, success) {
  let config = {
    url: '/api/erp/v1/role/select',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//角色修改确定（new）
api.roleUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/role/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}


//仓库管理库存统计(list)
api.depotStorageList = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/storage/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//仓库管理库存统计通过id获取数据
api.depotStorageGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/storage/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

api.depotStorageUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/storage/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据商品code查商品信息
api.findProductByCode = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/storage/search',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.depotStorageAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/storage/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }

  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.depotStorageDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/storage/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//采购审批
api.purAudit = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/audit',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购审批驳回
api.purReject = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/reject',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//订单导入
api.orderUpload = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/upload',
    method: 'post',
    timeout: 1000 * 60 * 20,
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//订单列表
api.erpOrderList = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//订单删除
api.erpOrderDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/delete',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//查看订单get/one
api.erpOrderGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//发货单导入
api.deliveryUpload = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/delivery/upload',
    method: 'post',
    timeout: 1000 * 60 * 3,
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}


//审批确认接口
api.purConfirm = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/confirm',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//采购申请发起接口
api.approvalRequest = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/approvalRequest',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//取消采购申请接口
api.cancelApproval = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/cancelApproval',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//终审接口(新)
api.applyConfirm = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/apply/confirm',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//批量商品入库接口
api.purBatchAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/batch/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购商品入库性情接口
api.purBatchItem = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/batch/item',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//新采购开票创建接口

api.erpInvoiceAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//查票
api.erpInvoiceGet = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/get/invoices',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌统计创建接口
api.erpBrandInfoAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/info/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌统计保存接口
api.erpBrandInfoUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/info/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//品牌统计删除接口
api.erpBrandInfoDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/brand/info/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//采购供应商的接口
api.erpPurSupply = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/supply',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//根据供应商的id获取商品的下拉接口
api.erpPurSupplyProduct = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/supply/product',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//订单改变状态
api.orderUpdateStatus = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/update/status',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//订单生成发货单
api.orderCreateOut = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/create/out',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//日常收支list
api.erpDisburseList = function (data, success) {
  let config = {
    url: '/api/erp/v1/disburse/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//日常收支Add接口
api.erpDisburseAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/disburse/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//日常收支update
api.erpDisburseUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/disburse/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//日常收支delete
api.erpDisburseDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/disburse/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//日常收支getOne
api.erpDisbursegetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/disburse/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//授权产品导出
api.productItemUpload = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/download',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//授权产品修改
api.productItemUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/product/item/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//客服的新接口（new)
//list接口
//客服list接口
api.orderQueryOrder = function (data, success) {
  let config = {
    url: '/api/erp/v1/order/query/order',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.erpComplaintList = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客服创建Add接口
api.erpComplaintAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客服修改接口
api.erpComplainReturn = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/return/info',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
api.erpComplainDepotListAll = function (data, success) {
  let config = {
    url: '/api/erp/v1/depot/list/all',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//退货
api.complainApplyReturn = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/return',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//入库
api.complainStockInItems = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/stock/in/items',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//入库详情确定按钮
api.complainApplyStockIn = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/stock/in',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//换货接口
api.complainApplyReplaceInfo = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/replace/info',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道接口（all）
api.channelAll = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/all',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//公司接口（all）
api.companyAll = function (data, success) {
  let config = {
    url: '/api/erp/v1/company/all',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//渠道接口（all）
api.productQueryByChannel = function (data, success) {
  let config = {
    url: '/api/erp/v1/channel/product/query/by/channel',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//换货确定接口
api.complainApplyReplace = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/replace',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客诉申请补发 获取客诉绑定的原订单信息
api.complainApplyRessiueInfo = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/reissue/info',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客诉申请补发 获取客诉绑定的原订单信息
api.complainApplyRessiue = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/apply/reissue',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客服getOne接口
api.erpComplaintGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客服更新
api.erpComplaintUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客服删除
api.erpComplaintDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//客服解决
api.erpComplaintSolve = function (data, success) {
  let config = {
    url: '/api/erp/v1/complain/solve',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//非平台订单list
api.internalOrderAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//非平台订单查询接口(add页面)
api.internalOrderQuerySupplyItems = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/query/supply/items',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//非平台订单list
api.internalOrderList = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//非平台订单删除
api.internalOrderDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//非平台订单查看
api.internalOrderGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//内部订单确认收货
api.internalOrderConfirm = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/confirm',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//内部订单发货
api.internalOrderDeliver = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/deliver',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//内部订单发货单导出
api.internalOrderDeliveryDownload = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/delivery/download',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//内部订单发货单导出
api.internalOrderDeliveryUpload = function (data, success) {
  let config = {
    url: '/api/erp/v1/internal/order/delivery/upload',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}


//采购订单上传附件
api.purUploadContract = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/upload/contract',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
//客服外部订单的add
api.externalComplainAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/external/complain/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.externalComplainList = function (data, success) {
  let config = {
    url: '/api/erp/v1/external/complain/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.externalComplainGetOne = function (data, success) {
  let config = {
    url: '/api/erp/v1/external/complain/get/one',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.externalComplainUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/external/complain/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.externalComplainDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/external/complain/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.externalComplainSolve = function (data, success) {
  let config = {
    url: '/api/erp/v1/external/complain/solve',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
//采购打款查看
api.invoiceRemitGetDetail = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/remit/getDetail',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}

//获取采购发票文件接口
api.invoiceResource = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/resource',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
//获取采购发票文件删除接口
api.invoiceResourceDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/resource/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
//获取采购合同文件接口
api.invoiceContactResource = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/invoice/contract/resource',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status == 200)
        success(data.data);
      else
        console.log(data)
    })
}
api.purchaseExcelExport = function (data, success) {
  let config = {
    url: '/api/erp/v1/pur/export',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}

//商品品类的接口添加
api.itemCategoryAdd = function (data, success) {
  let config = {
    url: '/api/erp/v1/item/category/add',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//商品品类的删除
api.itemCategoryDelete = function (data, success) {
  let config = {
    url: '/api/erp/v1/item/category/delete',
    method: 'get',
    params: data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//商品品类更新
api.itemCategoryUpdate = function (data, success) {
  let config = {
    url: '/api/erp/v1/item/category/update',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
//商品品类的接口list
api.itemCategoryList = function (data, success) {
  let config = {
    url: '/api/erp/v1/item/category/list',
    method: 'post',
    data,
    headers: {
      'content-type': 'application/json'
    }
  };
  return service(config)
    .then((data) => {
      if (data.status === 200)
        success(data.data);
      else
        console.log(data)
    })
    .catch()
}
export default api;
